<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-2.2.4.min.js"></script>
</head>
<body>
<form>
    用户名: <input type="text" id="username"> <p id="sb" ></p><br>
    密码 <input type="password"><br>
    <input type="submit" value="提交">
</form>
<script>
    function checkUsername(){

           /* $.get("/travel/checkUsername?username="+$("#username").val(),function (data,status){
                if (data=="false"){
                    $("#sb").html("不可以");
                }else {
                    $("#sb").html("可以");
                }
            });*/
            $.ajax({
                type:'get',
                url:"/travel/checkUsername?username="+$("#username").val(),
                dataType:'json',
                success:function (data) {
                    if (data.value=="false"){
                        $("#sb").html("不可以");
                    }else {
                        $("#sb").html("可以");
                    }
                },
                error:function (data) {
                    console.log("error");
                }
            })
    }
    $("#username").blur(checkUsername);

</script>
</body>
</html>